((w, doc) => {
  let domNodePool = [];
  function createApp(options) {
    for (let k in options) {
      switch (k) {
        case "components":
          initComponents(options[k]);
          break;
        case "methods":
          break;
        default:
          break;
      }
    }
    return {
      mount: function (el) {
        const oFrag = doc.createDocumentFragment();
        const app = doc.querySelector(el);
        domNodePool.forEach((div) => oFrag.appendChild(div));
        app.appendChild(oFrag);
      },
    };
  }
  function initComponents(components) {
    for (let component of components) {
      let [template, state] = component();
      const node = compile(template, state);
      domNodePool.push(node);
    }
  }
  w.createApp = createApp;
})(window, document);
